﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MobiSms.Infrastructure;

namespace MobiSms.DataModel
{
    public partial class ContactInfo : NotificationObject
    {
        private string name;
        private string mobile = string.Empty;
        private bool selected = true;
        private DateTime birthday = DateTime.Now;
        private bool stored = false;

        public string Name
        {
            get { return name; }
            set
            {
                name = value;
                RaisePropertyChanged(() => Name);
            }
        }

        public string Mobile
        {
            get { return mobile; }
            set
            {
                mobile = value;
                RaisePropertyChanged(() => Mobile);
            }
        }

        public bool IsSelected
        {
            get { return selected; }
            set
            {
                selected = value;
                RaisePropertyChanged(() => IsSelected);
            }
        }

        public DateTime Birthday
        {
            get { return birthday; }
            set
            {
                birthday = value;
                RaisePropertyChanged(() => Birthday);
            }
        }

        public bool Stored
        {
            get { return stored; }
            set
            {
                stored = value;
                RaisePropertyChanged(() => Stored);
            }
        }

        public event EventHandler<PropertyArgs> ValueChanged = delegate { };

        protected override void RaisePropertyChanged(string propertyName)
        {
            base.RaisePropertyChanged(propertyName);
            ValueChanged.Invoke(this, new PropertyArgs()
            {
                Property = GetType().GetProperty(propertyName),
                Value = GetType().GetProperty(propertyName).GetValue(this, null)
            });
        }
    }
}
